package com.example.demo.mapper;

import com.example.demo.entity.CrRepairOrder;
import com.example.demo.entity.InteInquire;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RepairOrderMapper {
    /*积分查询*/
   @Select("SELECT customerName,phone,carNumber,sum(totalPrice) as totalPrice FROM cr_customer JOIN cr_repair_order on cr_customer.id = cr_repair_order.customerId WHERE customerName like CONCAT('%',#{names},'%') and carNumber like CONCAT('%',#{car},'%') GROUP BY customerName ORDER BY totalPrice DESC")
    List<InteInquire> selectAll(@Param("names")String names, @Param("car")String car);
    /*报表查询*/
    @Select("SELECT customerName,phone,carNumber,cr_repair_order.createTime,sum(totalPrice) as totalPrice FROM cr_customer JOIN cr_repair_order on cr_customer.id = cr_repair_order.customerId WHERE customerName like CONCAT('%',#{names},'%') and carNumber like CONCAT('%',#{carNum},'%') GROUP BY carNumber ORDER BY cr_repair_order.createTime DESC")
    List<InteInquire> selectReport(@Param("names")String names, @Param("carNum")String carNum);
    /*维修清单全部查询*/
    @Select("SELECT * FROM cr_repair_order")
    List<CrRepairOrder> selectAllOrder();
}
